package com.example.lock;


import org.openjdk.jol.info.ClassLayout;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 *
 *
 * 公司：德迅科技
 * 作者：wangdi
 * 描述：
 * 日期： 2025/11/5
 *
 * @author DEO
 */

public class LockReentrantReadWriteDemo {


    private static final LockedObject LOCKED_OBJECT = new LockedObject();

    private static final AtomicInteger counter = new AtomicInteger(0);



    public static void main(String[] args) throws InterruptedException {
        ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock();
        ReentrantReadWriteLock.WriteLock writeLock = reentrantReadWriteLock.writeLock();
        writeLock.tryLock();
        writeLock.lock();
        writeLock.unlock();
    }

    public static class LockedObject {
        private int id;
        private String name;
    }


}
